var globalParam = globalParam || (function () {
    var resources = {
        //环境设置 dev/sit/uat/pre
        profile: "dev",
        //url访问基本地址
        basicUrl: {
            dev: "http://192.168.11.83:8080/",
            sit: "http://127.0.0.1:8080/",
            uat: "http://127.0.0.1:8080/",
            pre: "http://127.0.0.1:8080/",
        },
        //作用域 test:测试访问json,其他访问正式url  formal
        scope: "formal",
        url: {
            test: {
                index: {
                    //获取场景/产品
                    init: "json/index/init.json",
                    //根据产品取场景
                    getSceneByProductNo: "json/index/getSceneByProductNo.json",
                    //获取请求报文模板
                    getTemplet: "json/index/getTemplet.json",
                    //获取响应报文模板
                    testAction: "json/index/testAction.json",
                    //保存请求报文
                    savaReq:"json/common.json"
                },
                create: {
                    //获取用列列表
                    getUseCaseList: "json/create/getUseCaseList.json",
                    //选择模型
                    choose:"json/common.json"
                },
                edit: {
                    //获取数据源列表列表
                    init: "json/edit/init.json",
                    //获取具体数据源初始入参/预期值
                    getInitData:"json/edit/getInitData.json",
                    //全部保存
                    submitAll:"json/edit/submitAll.json",
                    //获取请求报文
                    getReq:"json/edit/getReq.json"
                },
                add: {
                    //获取数据源列表列表
                    init: "json/add/init.json",
                    //获取具体数据源初始入参/预期值
                    getInitData:"json/add/getInitData.json",
                    //全部保存
                    submitAll:"json/add/submitAll.json"
                },
                editTemp : {
                    //获取全部数据源列表列表
                    init: "json/edit/init.json",
                    //获取具体数据源初始入参/预期值
                    getInitData:"json/edit/getInitData.json",
                    //全部保存
                    submitAll:"json/edit/submitAll.json"
                }
            },
            formal: {
                index: {
                    init: "/index/getProductScene",
                    getSceneByProductNo: "/index/getSceneByProduct",
                    getTemplet: "/index/getEnterMould",
                    testAction: "/index/riskInterface",
                    savaReq:"/index/saveEnterParam"
                },
                create: {
                    getUseCaseList: "/edit/getTemplatesByPager",
                    choose:"/edit/saveMockMould"
                },
                edit: {
                    init: "/edit/getTemplateDatasourceList",
                    getInitData:"/edit/getTemplateMould",
                    submitAll:"/edit/saveMockMould",
                    getReq:"/index/getEnterParam"
                },
                add: {
                    init: "/add/getAllDatasourceList",
                    getInitData:"/add/getOriginalMould",
                    submitAll:"/add/saveTemplate"
                },
                editTemp: {
                    init: "/edit/getTemplateDatasourceList",
                    getInitData:"/edit/getTemplateMould",
                    submitAll:"/edit/modifyTemplate",
                }
            }
        }
    };
    return {
        getScope: function () {
            return resources.scope;
        },
        getUrl: function (parent, children) {
            if (resources.scope == "test") {
                if (resources.url.test[parent] && resources.url.test[parent][children]) {
                    return resources.url.test[parent][children];
                }
                return "";
            }
            if (resources.url.formal[parent] && resources.url.formal[parent][children]) {
                var basicUrl = resources.basicUrl[resources.profile] || "";
                return basicUrl + resources.url.formal[parent][children];
            }
            return "";
        }
    };
})(window);